<template>
    <el-container class="home-container">
        <!-- 头部区域 -->
        <el-header>
            <div>
                <img src="../assets/logo.png" alt="" style="width: 40px;position: relative;top:5px">
                <span>劳务管理系统</span>
            </div>
            <el-button type="info" @click="logout">退出</el-button>
        </el-header>
        <!-- 页面主体区域 -->
        <el-container>

            <!-- 侧边栏 -->
            <el-aside width="isCollapse ? '64px' : '200px'">
                <!-- <el-input placeholder="搜索菜单" style="height: 60px">
                    <i slot="prefix" class="el-input__icon el-icon-search"></i>
                </el-input> -->
                <div class="toggle-button" @click="toggleCollapse">| | |</div>
                <!-- 侧边栏菜单区域 -->
                <el-menu background-color="#606266" text-color="#fff" active-text-color="#409EFF" :collapse="isCollapse"
                    :collapse-transition="false" :router="true" 
                    default-active="/1">
                    <el-menu-item index="1" key="item.id">
                        <i class="el-icon-location"></i>
                        <span slot="title">参与单位管理</span>
                    </el-menu-item>
                    <el-menu-item index="2">
                        <i class="el-icon-menu"></i>
                        <span slot="title">项目统计管理</span>
                    </el-menu-item>
                    <el-menu-item index="3">
                        <i class="el-icon-document"></i>
                        <span slot="title">劳务工程管理</span>
                    </el-menu-item>
                    <el-menu-item index="4">
                        <i class="el-icon-setting"></i>
                        <span slot="title">劳务班组管理</span>
                    </el-menu-item>
                    <el-menu-item index="5">
                        <i class="el-icon-notebook-1"></i>
                        <span slot="title">工人名册管理</span>
                    </el-menu-item>
                    <el-menu-item index="6">
                        <i class="el-icon-copy-document"></i>
                        <span slot="title">考勤统计管理</span>
                    </el-menu-item>
                    <el-menu-item index="7">
                        <i class="el-icon-notebook-2"></i>
                        <span slot="title">工资记录管理</span>
                    </el-menu-item>
                    <el-menu-item index="8">
                        <i class="el-icon-tickets"></i>
                        <span slot="title">劳务结算管理</span>
                    </el-menu-item>
                    <el-menu-item index="9">
                        <i class="el-icon-s-data"></i>
                        <span slot="title">上工人数管理</span>
                    </el-menu-item>
                </el-menu>
            </el-aside>

            <!-- 右侧内容主体 -->
            <el-main>
                <!-- 路由占位符 -->
                <router-view></router-view>
            </el-main>
        </el-container>
    </el-container>
</template>

<script>
import { RouterView } from 'vue-router';

export default {
    data() {
        return {
            //是否折叠
            isCollapse: false
        };
    },
    methods: {
        logout() {
            window.sessionStorage.clear();
            this.$router.push("/login");
        },
        //点击按钮切换菜单的折叠与展开
        toggleCollapse() {
            this.isCollapse = !this.isCollapse;
        }
    },
    components: { RouterView }
};
</script>

<style lang="less" scoped>
.home-container {
    height: 100%;
}

.el-header {
    background-color: #606266;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    font-size: 20px;

    >div {
        display: flex;
        align-items: center;

        span {
            margin-left: 15px;
        }
    }
}

.el-aside {
    background-color: #606266;
}

.el-main {
    background-color: #EBEEF5;
}

.toggle-button {
    background-color: #909399;
    font-size: 10px;
    line-height: 24px;
    color: #fff;
    text-align: center;
    cursor: pointer;
}
</style>